/**
 * 所有版权归 广西梧州 陈锦韬 所有
 *
 * @Title: RxLog
 * @Package com.rx.core.util
 * @Description: 日志类
 * @author: 陈锦韬
 * @date: 2020\4\19 0019
 * @version V1.0
 * @Copyright: 2020 陈锦韬  All rights reserved.
 */
package com.rx.core.util;

import lombok.extern.slf4j.Slf4j;
import org.slf4j.LoggerFactory;

/**
 * @author: Administrator
 * @Description: 日志类
 * @date: 2020\4\19 0019
 */
@Slf4j
public class RxLog {

    public static String perfix = "############## ";

    public static void error(String msg) {
        LoggerFactory.getLogger(getClassName()).error(perfix + msg);
    }

    public static void error(String msg, Object... obj) {
        LoggerFactory.getLogger(getClassName()).error(perfix + msg, obj);
    }


    public static void warn(String msg) {
        LoggerFactory.getLogger(getClassName()).error(perfix + msg);
    }

    public static void warn(String msg, Object... obj) {
        LoggerFactory.getLogger(getClassName()).error(perfix + msg, obj);
    }


    public static void info(String msg) {
        LoggerFactory.getLogger(getClassName()).info(perfix + msg);
    }

    public static void info(String msg, Object... obj) {
        LoggerFactory.getLogger(getClassName()).info(perfix + msg, obj);
    }

    public static void debug(String msg) {
        LoggerFactory.getLogger(getClassName()).debug(perfix + msg);
    }

    public static void debug(String msg, Object... obj) {
        LoggerFactory.getLogger(getClassName()).debug(perfix + msg, obj);
    }


    private static String getClassName() {
        return new SecurityManager() {
            public String getClassName() {
                return getClassContext()[3].getName();
            }
        }.getClassName();
    }
}
